package com.yishun.springboot;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.yinquan.util.BeanUtil;
import com.yinquan.util.DataUtil;

import lombok.extern.slf4j.Slf4j;

@SpringBootApplication
@EnableScheduling
@EnableAsync
@EnableTransactionManagement
@MapperScan(basePackages = { "com.yishun.springboot.mapper" })
@Slf4j
public class Application {

	private static final Logger logger = LoggerFactory.getLogger(Application.class);

	public static void main(String[] args) {
		// SpringApplication.run(Application.class, args);
		logger.info("SpringBoot开始加载");
		// run方法的返回值ConfigurableApplicationContext继承了ApplicationContext上下文接口
		ConfigurableApplicationContext applicationContext = SpringApplication.run(Application.class, args);
		// 将run方法的返回值赋值给工具类中的静态变量
		BeanUtil.applicationContext = applicationContext;
		log.info(DataUtil.currTime());
		logger.info("SpringBoot加载完毕");
		// FixedPrintTask FixedPrintTask = new FixedPrintTask ();
		// FixedPrintTask.execute();
		// 在spring启动类进行定时任务的
		// new TestTsp().test();
		// 改动上传test
	}

}